const fs = require("fs");
const path = require("path");
let dts = fs.readFileSync(path.resolve(__dirname, "dist/kcoder.d.ts"), "utf-8");
dts = dts.replace(/declare /g, "");
dts = dts.replace(/export .*/, "");
dts = dts.replace("\n\n\n", "");
dts = dts.split("\n").map(line => line ? "    " + line : line).join("\n");
dts = `declare namespace kcoder {\n${dts}\n}`;
fs.writeFileSync(path.resolve(__dirname, "dist/umd/kcoder.d.ts"), dts, { encoding: "utf-8", flag: "w+" });
